package com.vpen.picupload.enums;
import lombok.Getter;
import lombok.experimental.Accessors;

/**
* @author: 韦鹏
* @name:
* @date: 2021/8/5 23:37
* @param:
* @return:
* @作用:
**/
@Getter
@Accessors(chain = true)
public enum Color {
    /**
     * @author:韦鹏
     * @desc:
     * */
    RED("红色", 1),
    /**
     * @author:韦鹏
     * @desc:
     * */
    GREEN("绿色", 2);
    /**
     * @author:韦鹏
     * @desc:
     * */
    private final String name;
    /**
     * @author:韦鹏
     * @desc:
     * */
    private final Integer index;
    /**
    * @author: 韦鹏
    * @name: Color
    * @date: 2021/8/5 23:35
    * @param: [name, index]
    * @return:
    * @作用:
    **/
    Color(String name, Integer index) {
        this.name = name;
        this.index = index;
    }
    /**
    * @author: 韦鹏
    * @name: getName
    * @date: 2021/8/5 23:32
    * @param: [index]
    * @return: java.lang.String
    */
    public static String getName(Integer index){
        for (Color c: Color.values()){
            if (c.getIndex().equals(index)){
                return c.name;
            }
        }
        return null;
    }
}
